package cn.edu.lit.jsjxy.CourseExample;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import cn.edu.lit.jsjxy.CourseExample.chapter2.MainActivity_Chap2;
import cn.edu.lit.jsjxy.CourseExample.chapter3.MainActivity_Chap3;
import cn.edu.lit.jsjxy.CourseExample.chapter4.MainActivity_chap4;
import cn.edu.lit.jsjxy.CourseExample.chapter5.MainActivity_Chap5;
import cn.edu.lit.jsjxy.CourseExample.chapter8.MainActivity_chap8;

public class GeneralActivity extends AppCompatActivity implements
        View.OnClickListener
{
    Button btnChapter1, btnChapter2, btnChapter3, btnChapter4,btnChapter5,btnChapter8;


    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_general);

        btnChapter1 = findViewById(R.id.btnChapter1);
        btnChapter2 = findViewById(R.id.btnChapter2);
        btnChapter3 = findViewById(R.id.btnChapter3);
        btnChapter4 = findViewById(R.id.btnChapter4);
        btnChapter5 = findViewById(R.id.btnChapter5);

        btnChapter8 = findViewById(R.id.btnChapter8);


        btnChapter1.setOnClickListener(this);
        btnChapter2.setOnClickListener(this);
        btnChapter3.setOnClickListener(this);
        btnChapter4.setOnClickListener(this);
        btnChapter5.setOnClickListener(this);
        btnChapter8.setOnClickListener(this);

    }

    @Override
    public void onClick(View view)
    {
        Intent intent = new Intent();

        switch (view.getId())
        {
            case R.id.btnChapter2:
                intent.setClass(this, MainActivity_Chap2.class);
                break;
            case R.id.btnChapter3:
                intent.setClass(this, MainActivity_Chap3.class);
                break;
            case R.id.btnChapter4:
                intent.setClass(this, MainActivity_chap4.class);
                break;
            case R.id.btnChapter5:
                intent.setClass(this, MainActivity_Chap5.class);
                break;
            case R.id.btnChapter8:
                intent.setClass(this, MainActivity_chap8.class);
                break;
        }

        startActivity(intent);

    }
}
